#ifndef CORE_RECT_PRIMITIVE_SAMPLE_H
#define CORE_RECT_PRIMITIVE_SAMPLE_H
#include "SampleBase.h"
#include "glad\glad.h"
#include "Types.h"
#include "Sphere.h"
#include "HitableList.h"
#include "ImageParam.h"
#include "Camera.h"
#include "Lambertian.h"
#include "Rectangle.h"
namespace RayTracer
{
	class RectPrimitiveSample : public SampleBase
	{
	public:
		RectPrimitiveSample() = default;
		~RectPrimitiveSample() = default;

		void Init();
		void Render();
		void ImGui();
		void ShutDown();
	private:
		vec3 RayColor(const Ray& ray, const Hitable& world, int depth);
	private:
		int curIndex;
		bool isGenerate;
		GLuint mTexHandle = 0;
		ImageParam mImageParam; // output image
		int samples_per_pixel = 10;
		int maxDepth = 10;
		bool isNormal = false;
		// scene
		HitableList world;
		std::shared_ptr<Sphere> floor;
		std::shared_ptr<XY_Rect> xy_Rect;
		std::shared_ptr<XZ_Rect> xz_Rect;
		std::shared_ptr<YZ_Rect> yz_Rect;
		std::shared_ptr<YZ_Rect> yz_RectR;

		std::shared_ptr<Lambertian> floorMat;
		std::shared_ptr<Lambertian> xy_RectMat;
		std::shared_ptr<Lambertian> xz_RectMat;
		std::shared_ptr<Lambertian> yz_RectMat;
		std::shared_ptr<Lambertian> yz_RectRMat;

		// camera
		Camera camera;
		vec3 lookfrom;
		vec3 lookat;
		float fov;
		// viewport
		vec3 origin = vec3(0, 0, 0);
		vec3 horizontal;
		vec3 vertical;
		vec3 lower_left_corner;

		// sky color
		vec3 upColor;
		vec3 downColor;

		vec3 groundColor;
		vec3 xy_RectColor;
		vec3 xz_RectColor;
		vec3 yz_RectColor;
		vec3 yz_RectRColor;
	};
}
#endif // !CORE_PRIMITIVE_SAMPLE_H
